package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.RaApplication;
import com.ctrl.riveradministrator.mvp.model.ChannelSeg;
import com.ctrl.riveradministrator.mvp.view.activity.channel_segment.ChannelSegView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ChannelSegPresenter  extends BasePresenter<ChannelSegView> {

    public ChannelSegPresenter(ChannelSegView baseView) {
        super(baseView);
    }

    public void getSegInfo(String pageNumb, String pageSize){
        Map<String, String> map = new HashMap<>();
        map.put("pageNumb", pageNumb);
        map.put("pageSize", pageSize);
        map.put("userId", RaApplication.getUserId());
        attachView(apiService.getSegInfo(map),new BaseObserver<ChannelSeg>(getBaseView()){

            @Override
            public void onSuccess(ChannelSeg model) {
                Log.d("Tgh", "onSuccess: ");
            }

            @Override
            public void onSuccess(List<ChannelSeg> model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("Tgh", "onFailed: "+msg);
            }
        });
    }

}
